<template>
  <div class="tab-bar-item" @click="activeClick">
    <div :style="isActive?{color:mineColor}:{}"><slot name="tab-font"></slot></div>
    <div :style="isActive?{color:mineColor}:{}"><slot name="tab-text"></slot ></div>
  </div>

</template>

<script>
  export default {
    name: "TabBarItem",
    props: {
      path: String,
      mineColor: {
        type: String,
        default: 'red'
      }
    },
    computed:{
      isActive(){
        return this.$route.path.indexOf(
            this.path
        )!=-1
      }
    },
    methods: {
      activeClick(){
        this.$router.push(this.path)
      }
    }
  }
</script>

<style scoped>
.tab-bar-item{
  flex:1;
  text-align: center;
  height: 49px;
  padding-top: 5px;
}
</style>